﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace NASA.BeAMartian.Controls
{
    public partial class ProcessingIndicator : UserControl
    {
        private bool isInitialized = false;

        public ProcessingIndicator()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(Loading_Loaded);
        }

        void Loading_Loaded(object sender, RoutedEventArgs e)
        {
            if (this.isInitialized == false)
            {
                this.Loader.Begin();
                this.Loader.Pause();
                this.isInitialized = true;
            }
            this.Loader.RepeatBehavior = RepeatBehavior.Forever;
        }

        public void Stop()
        {
            this.Loader.Pause();
        }

        public void Start()
        {
            if (this.isInitialized == false)
            {
                this.Loader.Begin();
                this.isInitialized = true;
            }
            else
            {
                this.Loader.Resume();
            }
        }
    }
}
